from django.db import models
from django.utils.translation import ugettext_lazy as _

from .services import get_uav_image_path
from .services import get_camera_image_path


class UAV(models.Model):
    """
    无人机型号
    """
    name = models.CharField(max_length=255, null=False, blank=False, verbose_name=_("uav"))
    "公司"
    company = models.CharField(max_length=128, null=False, blank=True, verbose_name=_("company"))
    "飞行时长"
    fly_time = models.CharField(max_length=32, verbose_name=_("fly time"))
    "抗风等级"
    wind_loading = models.CharField(max_length=64, verbose_name=_("wind loading"))
    "无人机图片"
    image = models.FileField(upload_to=get_uav_image_path, max_length=500, null=True, blank=True,
                             verbose_name=_("uav image"))

    class Meta:
        verbose_name = "无人机"
        verbose_name_plural = "无人机"


class Camera(models.Model):
    """
    镜头型号
    """
    name = models.CharField(max_length=255, null=False, blank=False, verbose_name=_("camera"))
    "公司"
    company = models.CharField(max_length=128, null=False, blank=True, verbose_name=_("company"))
    "可见光分辨率"
    visible_pixel = models.CharField(max_length=32, verbose_name="可见光分辨率", default="")
    "热成像分辨率"
    infrared_pixel = models.CharField(max_length=32, verbose_name="热成像分辨率", default="")
    "镜头图片"
    image = models.FileField(upload_to=get_camera_image_path, max_length=500, null=True, blank=True,
                             verbose_name=_("camera image"))

    class Meta:
        verbose_name = "镜头"
        verbose_name_plural = "镜头"
